﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Communicator.Common.Utility
{
    public class StringUtils
    {
        private static string REGEX_PATTERN = "\\p{IsCombiningDiacriticalMarks}+";

        /// <summary>
        /// Parses from vietnamese signed string to unsigned string
        /// </summary>
        /// <param name="signedString">signed string</param>
        /// <returns>unsigned string</returns>
        public static string ParseUnsign(string signedString)
        {
            System.Text.RegularExpressions.Regex regex = new System.Text.RegularExpressions.Regex(REGEX_PATTERN);
            string temp = signedString.Normalize(NormalizationForm.FormD);
            return regex.Replace(temp, String.Empty).Replace('\u0111', 'd').Replace('\u0110', 'D');
        }
    }
}
